<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>阻止事件行为</title>
</head>

<body>
    <a href="javascript:void(0)">javascript:void(0)</a>
    <a id="a01" href="http://www.ekgc.cn">课工场01</a>
    <a id="a02" href="http://www.ekgc.cn">课工场02</a>
</body>

</html>
<script>
    let a01 = window.document.querySelector('#a01');
    a01.addEventListener('click', function(e) {
        // dom 标准写法
        e.preventDefault();
    });
    let a02 = window.document.querySelector('#a02');
    a02.onclick = function(e) {
        // 
        e.returnValue;
        return false;
    };
</script>